// import com.alibaba.druid.sql.ast.*;
// import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSegmentAttributes;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;
// import com.alibaba.druid.util.FnvHash;

// import java.util.ArrayList;
// import java.util.List;
#pragma once
#include "../SQLStatementImpl.h"
#include "../SQLReplaceable.h"
#include "../../dialect/oracle/ast/OracleSegmentAttributes.h"
#include "SQLCreateStatement.h"

class SQLCreateMaterializedViewStatement
    : virtual public SQLStatementImpl,
      virtual public OracleSegmentAttributes,
      virtual public SQLCreateStatement,
      virtual public SQLReplaceable
{
public:
  SQLExpr_ptr lifyCycle;
  SQLName_ptr name;
  SQLName_list_ptr columns;
  BOOL_ptr ifNotExists;

  BOOL_ptr refreshFast;
  BOOL_ptr refreshComplete;
  BOOL_ptr refreshForce;
  BOOL_ptr refreshOnCommit;
  BOOL_ptr refreshOnDemand;
  BOOL_ptr refreshStartWith;
  BOOL_ptr refreshNext;

  BOOL_ptr buildImmediate;
  BOOL_ptr buildDeferred;

  SQLSelect_ptr query;

  // oracle
  int pctfree;
  int pctused;
  int initrans;

  int maxtrans;
  int pctincrease;
  int freeLists;
  BOOL_ptr compress;
  int compressLevel;
  BOOL_ptr compressForOltp;
  int pctthreshold;

  BOOL_ptr logging;
  BOOL_ptr cache;

  SQLName_ptr tablespace;
  SQLObject_ptr storage;

  BOOL_ptr parallel;
  int parallelValue;

  BOOL_ptr enableQueryRewrite;

  SQLPartitionBy_ptr partitionBy;
  SQLExpr_ptr startWith;
  SQLExpr_ptr next;

  BOOL_ptr withRowId;

  // for ADB
  BOOL_ptr refreshOnOverWrite;
  SQLTableElement_list_ptr tableElementList;
  SQLName_ptr distributedByType;
  SQLName_list_ptr distributedBy;
  SQLAssignItem_list_ptr tableOptions;
  SQLExpr_ptr comment;
  SQLName_list_ptr partitionedOn;

  SQLCreateMaterializedViewStatement();
  SHAREDOBJECT(SQLCreateMaterializedViewStatement);

  SQLName_ptr getName();

  void setName(SQLName_ptr name);

  BOOL_ptr isIfNotExists();

  void setIfNotExists(BOOL_ptr ifNotExists);

  SQLName_list_ptr getColumns();

  SQLSelect_ptr getQuery();

  void setQuery(SQLSelect_ptr query);

  BOOL_ptr isBuildImmediate();

  void setBuildImmediate(BOOL_ptr buildImmediate);

  BOOL_ptr isBuildDeferred();

  void setBuildDeferred(BOOL_ptr buildDeferred);

  BOOL_ptr isRefresh();

  BOOL_ptr isRefreshFast();

  void setRefreshFast(BOOL_ptr refreshFast);

  BOOL_ptr isRefreshComplete();

  void setRefreshComplete(BOOL_ptr refreshComplete);

  BOOL_ptr isRefreshForce();

  void setRefreshForce(BOOL_ptr refreshForce);

  BOOL_ptr isRefreshOnCommit();

  void setRefreshOnCommit(BOOL_ptr refreshOnCommit);

  BOOL_ptr isRefreshOnDemand();

  void setRefreshOnDemand(BOOL_ptr refreshOnDemand);

  BOOL_ptr isRefreshOnOverWrite();

  void setRefreshOnOverWrite(BOOL_ptr refreshOnOverWrite);

  BOOL_ptr isRefreshStartWith();

  void setRefreshStartWith(BOOL_ptr refreshStartWith);

  BOOL_ptr isRefreshNext();

  void setRefreshNext(BOOL_ptr refreshNext);

  int getPctfree();

  void setPctfree(int pctfree);

  int getPctused();

  void setPctused(int pctused);

  int getInitrans();

  void setInitrans(int initrans);

  int getMaxtrans();

  void setMaxtrans(int maxtrans);

  int getPctincrease();

  void setPctincrease(int pctincrease);

  int getFreeLists();

  void setFreeLists(int freeLists);

  BOOL_ptr getCompress();

  void setCompress(BOOL_ptr compress);

  int getCompressLevel();

  void setCompressLevel(int compressLevel);

  BOOL_ptr isCompressForOltp();

  void setCompressForOltp(BOOL_ptr compressForOltp);

  int getPctthreshold();

  void setPctthreshold(int pctthreshold);

  BOOL_ptr getLogging();

  void setLogging(BOOL_ptr logging);

  SQLName_ptr getTablespace();

  void setTablespace(SQLName_ptr tablespace);

  SQLObject_ptr getStorage();

  void setStorage(SQLObject_ptr storage);

  BOOL_ptr getParallel();

  void setParallel(BOOL_ptr parallel);

  int getParallelValue();

  void setParallelValue(int parallelValue);

  BOOL_ptr getEnableQueryRewrite();

  void setEnableQueryRewrite(BOOL_ptr enableQueryRewrite);

  BOOL_ptr getCache();

  void setCache(BOOL_ptr cache);

  SQLPartitionBy_ptr getPartitionBy();

  SQLTableElement_list_ptr getTableElementList();

  SQLName_list_ptr getDistributedBy();

  SQLName_ptr getDistributedByType();

  void setDistributedByType(SQLName_ptr x);

  SQLExpr_ptr getStartWith();

  void setStartWith(SQLExpr_ptr x);

  SQLExpr_ptr getNext();

  void setNext(SQLExpr_ptr x);

  void setPartitionBy(SQLPartitionBy_ptr x);

  BOOL_ptr isWithRowId();

  void setWithRowId(BOOL_ptr withRowId);

  SQLName_list_ptr getPartitionedOn();

  void addOption(string_ptr name, SQLExpr_ptr value);

  SQLAssignItem_list_ptr getTableOptions();

  SQLExpr_ptr getOption(string_ptr name);

  SQLExpr_ptr getComment();

  void setComment(SQLExpr_ptr x);

  SQLExpr_ptr getLifyCycle();

  void setLifyCycle(SQLExpr_ptr x);

  // @Override
  void accept0(SQLASTVisitor_ptr visitor);

  // @Override
  BOOL_ptr replace(SQLExpr_ptr expr, SQLExpr_ptr target);
};
